#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<bitset>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define rep(i,a,b) for(register int i = (a);i <= (b);++i)
#define per(i,a,b) for(register int i = (a);i >= (b);--i)  
typedef long long ll;
typedef unsigned long long ull;
using std::string;using std::cin;using std::cout;

const int N = 1e6+5;
int n,m,S[N],opt,ch;
std::bitset<35005> now,dp,id[1005];
//dp[i]的01表示l=i时是否合法

int read(){
	int ans=0;
	char ch=getchar();
	while(ch<'0'||ch>'9')
		ch=getchar();
	while(ch<='9'&&ch>='0'){
		ans=ans*10+ch-'0';
		ch=getchar();
	}
	return ans;
}

int main(){
    std::ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("in.in", "r", stdin);x
    n = read() , m = read();
    rep(i,1,n) S[i] = read();
    rep(i,1,m) id[ S[i] ].set(i);
    now.set();
    rep(i,1,m){
        now.reset(i);
        opt = read() , ch = read();
        //opt:0~末尾加
        //opt:1~开头加
        if(opt) dp = dp | (id[ch] << (i-1));
        else dp = (dp << 1) | id[ch];
        cout << (~(dp|now)).count() << "\n";
    }
    return 0;
}